<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.jiabonet.DB.staticBean"%>
<%
String path = request.getContextPath();
String Admin = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+staticBean.getAdminDir();
%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />		
		<title>用户权限管理</title>
		<style type="text/css">
<!--
body {
	margin-left: 3px;
	margin-top: 0px;
	margin-right: 3px;
	margin-bottom: 0px;
}
*{
	border:none;
}
.STYLE1 {
	color: #e1e2e3;
	font-size: 12px;
}

.STYLE6 {
	color: #000000;
	font-size: 12;
}

.STYLE10 {
	color: #000000;
	font-size: 12px;
}

.STYLE19 {
	color: #344b50;
	font-size: 12px;
}

.STYLE21,a {
	font-size: 12px;
	color: #3b6375;
}

.STYLE22 {
	font-size: 12px;
	color: #295568;
}

.text {
	width: 50px;
	height: 22px;
}
.STYLE23 {color: #33CC00}
-->
        </style>
<script src="<%=path%>/Public/js/jquery.min.js" type="text/javascript"></script>
<script src="<%=path%>/Public/js/jquery.timers.js" type="text/javascript"></script>
<script type="text/javascript">
	var allbox = new Array();
	$(function(){
		
		$("#tables tr").hover(
		  function () {
			$(this).css("background","#d5f4fe");
		  },
		  function () {
			$(this).css("background","#fff");
		  }
		);

		var StartPage = $("#StartPage");
		var Start = $("#Start");
		Start.click(function(){
			window.location.href="<%=path%>/Level!Level_List.action?page.GetPage="+parseInt(StartPage.val());
		});

		$("input[name='checkbox11']").click(function() {
            $('[id="checkbox10"]').attr("checked",this.checked);             
            if($(this).attr("isAllCheck") == "true") {
				$('[id="checkbox10"]').removeAttr("isCheck");
				$(this).removeAttr("isAllCheck");
			} else {
				$('[id="checkbox10"]').attr("isCheck", "true");
				$(this).attr("isAllCheck","true");
			}
        });
		
		$('[id="checkbox10"]').click(function(){
			if($(this).attr("isCheck") == "true") { 
				$(this).removeAttr("isCheck") 
			} else { 
				$(this).attr("isCheck", "true"); 
			} 
		});
		
        var DelAll = $("#DelAll");
        DelAll.click(function(){
        	getValues();
            if(allbox.length<=0){
            	$("#trDelall").show();
				$("#trDelall1").html("<font color='red'>请选择要删除的用户！</font>");
				$("#trDelall").oneTime(10000, function() {
					$(this).hide();
		        });
		        return false;
            }  
            var GetPage = $("input[name='GetPage']").val();
            //alert(allbox[0]+" "+GetPage);
        	$.ajax({
 			   type: "POST",
 			   url: "<%=path%>/Level!Level_DelAll.action?T="+Math.random(),
 			   data: "level.DelAll="+allbox+"&page.GetPage="+GetPage,
 			   success: function(msg){
 				  	alert(msg.returnInfo);
					window.location.href="<%=path%>/Level!Level_List.action?page.GetPage="+msg.page.getPage;
					//alert(msg);
		 	}
 			});
        });
	});

	function getDel(id){
		var GetPage = $("input[name='GetPage']").val();
    	$.ajax({
			   type: "POST",
			   url: "<%=path%>/Level!Level_Del.action?T="+Math.random(),
			   data: "level.Id="+id+"&page.GetPage="+GetPage,
			   success: function(msg){
				alert(msg.returnInfo);
				window.location.href="<%=path%>/Level!Level_List.action?page.GetPage="+msg.page.getPage;
			   }
			});
	}
	
	function getValues() 
	{ 
		allbox = [];//将数组清空
		$('[id="checkbox10"]').each(function(){ 
			if($(this).attr("isCheck") == "true"){ 
				allbox.push($(this).val()); 
			}
		}); 
		var alls="";
		/*
		for(var i=0;i<allbox.length;i++){
			alls+=allbox[i]+",";
		}
		alert(alls);
		*/
	} 
	function selectManage(Ids){
		var showWi = window.showModalDialog("Level!Level_Edit.action?level.Id="+Ids+"&T="+Math.random(), null,"dialogWidth=780px;dialogHeight=490px;status=no;help=no;scrollbars=no;location=no;frame=no;");   
	}

	function ManageAdd(){
		var showWi = window.showModalDialog("Level!Level_Add.action?T="+Math.random(), null,"dialogWidth=780px;dialogHeight=490px;status=no;help=no;scrollbars=no;location=no;frame=no;");   
	}

	function trim(str){ //删除左右两端的空格
		　　return str.replace(/(^\s*)|(\s*$)/g, "");
	}

	function reloads(){
		window.location.reload();
	}
	
</script>


	</head>

	<body>
		<table width="100%" border="0" align="center" cellpadding="0"
			cellspacing="0">
			<tr>
				<td height="30">
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td height="24" bgcolor="#353c44">
								<table width="100%" border="0" cellspacing="0" cellpadding="0">
									<tr>
										<td>
											<table width="100%" border="0" cellspacing="0"
												cellpadding="0">
												<tr>
													<td width="6%" height="19" valign="center">
														<div align="center">
															<img src="<%=Admin%>/images/tb.gif" width="14"
																height="14" />
														</div>
													</td>
													<td width="94%" valign="center">
														<span class="STYLE1"> 管理人员基本信息列表</span>
													</td>
												</tr>
											</table>
										</td>
										<td>
											<div align="right">
												<span class="STYLE1"> &nbsp;&nbsp;<img
														src="<%=Admin%>/images/add.gif" width="10" height="10" />
													<a href="#" onclick="ManageAdd();" class="STYLE1">添加用户权限</a>
													&nbsp; <a href="#" id="DelAll" class="STYLE1"><img src="<%=Admin%>/images/del.gif" width="10"
														height="10" /> 删除 </a>&nbsp;&nbsp;
											</div>
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td>
					<table width="100%" border="0" cellpadding="0" cellspacing="1"
						bgcolor="#a8c7ce" id="tables">
						<tr>							
							<td width="6%" bgcolor="d3eaef" class="STYLE6">
								<div align="center">
						  <span class="STYLE10">编号</span>								</div>							</td>
							<td width="18%" height="20" bgcolor="d3eaef" class="STYLE6">
								<div align="center">
						  <span class="STYLE10">权限名称</span>								</div>							</td>
							<td width="34%" height="20" bgcolor="d3eaef" class="STYLE6">
								<div align="center">
						  <span class="STYLE10">角色权限说明</span>							  </div>						  </td>
							<td width="11%" bgcolor="d3eaef" class="STYLE6"><div align="center">
						  <span class="STYLE10">权限标识</span>							  </div></td>
							<td width="14%" height="20" bgcolor="d3eaef" class="STYLE6">
								<div align="center">
						  <span class="STYLE10">角色权限状态</span>							  </div>						  </td>
							<td width="11%" height="20" bgcolor="d3eaef" class="STYLE6">
								<div align="center">
						  <span class="STYLE10">其他操作</span>							  </div>						  </td>
							<td width="8%" height="20" bgcolor="d3eaef" class="STYLE6">
								<div align="center">
									<input type="checkbox" name="checkbox11" id="checkbox11" />
						  </div>						  </td>
						</tr>
						<s:iterator value="List" id="content">
							<tr bgcolor="#FFFFFF">
								<td class="STYLE19">
									<div align="center">
										<s:property value="#content.Id" />
									</div>								</td>
								<td height="20" class="STYLE19">
									<div align="center">
										<s:property value="#content.Name" />
									</div>								</td>
								<td height="20" class="STYLE19">
									<div align="center">
										<s:property value="#content.Content" />
									</div>								</td>
								<td class="STYLE19"><div align="center">
                                  <s:property value="#content.LevelNum" />
                                </div></td>
								<td height="20" class="STYLE19">
									<div align="center">
										<s:if test="#content.State==1">
										运行中			</s:if>
																<s:else>
											  关闭中			</s:else>
									</div>								</td>
								<td height="20">
									<div align="center">
										<span class="STYLE21"><a href="#" onclick="getDel(<s:property value="#content.Id"/>);">删除</a>
											| <a href="#"
											onclick="selectManage(<s:property value="#content.Id"/>);"
											class="text">查看</a> </span>									</div>								</td>
								<td height="20">
									<div align="center">
										<input type="checkbox" name="login.checkbox10[]" id="checkbox10" value="<s:property value="#content.Id"/>" />									</div>								</td>
							</tr>
						</s:iterator>
						<tr bgcolor="#FFFFFF" style="display:none;" id="trDelall">
							  <td height="20" colspan="9" class="STYLE19"><div align="center" class="STYLE23" id="trDelall1"></div></td>
						  </tr>
					</table>
				</td>
			</tr>
			
			<tr>
				<td height="30">
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td width="33%">
								<div align="left">
									<span class="STYLE22">&nbsp;&nbsp;&nbsp;&nbsp;共有<strong>
											<s:property value="page.ListRow" /></strong> 条记录，当前第<strong> <s:property value="page.GetPage" /><input type="hidden" value="<s:property value="page.GetPage" />" name="GetPage" ></strong> 页，共 <strong> <s:property value="page.intPageCount" /> </strong> 页</span>
								</div>
							</td>
							<td width="67%">
								<table width="312" border="0" align="right" cellpadding="0"
									cellspacing="0">
									<s:url id="url_index" value="Level!Level_List.action">
										<s:param name="page.GetPage" value="1"></s:param>
									</s:url>
									<s:url id="url_pre" value="Level!Level_List.action">
										<s:param name="page.GetPage" value="page.GetPage-1"></s:param>
									</s:url>
									<s:url id="url_next" value="Level!Level_List.action">
										<s:param name="page.GetPage" value="page.GetPage+1"></s:param>
									</s:url>
									<s:url id="url_end" value="Level!Level_List.action">
										<s:param name="page.GetPage" value="page.intPageCount"></s:param>
									</s:url>
									<tr>
										<td width="49">
											<div align="center">
												<s:a href="%{url_index}"><img src="<%=Admin%>/images/main_54.gif" width="40"
													height="15" />
													</s:a>
											</div>
										</td>
										<td width="49">
											<div align="center">
												<s:a href="%{url_pre}">
													<img src="<%=Admin%>/images/main_56.gif" width="45"
														height="15" />
												</s:a>
											</div>
										</td>
										<td width="49">
											<div align="center">
											<s:a href="%{url_next}">
												<img src="<%=Admin%>/images/main_58.gif" width="45"
													height="15" />
											</s:a>
											</div>
										</td>
										<td width="49">
											<div align="center">
											<s:a href="%{url_end}">
												<img src="<%=Admin%>/images/main_60.gif" width="40"
													height="15" />
											</s:a>
											</div>
										</td>
										<td width="37" class="STYLE22">
											<div align="center">
												转到
											</div>
										</td>
										<td width="22">
											<div align="center">
												<input type="text" name="StartPage" id="StartPage" value="" style="width: 20px; height: 12px; font-size: 12px; border: solid 1px #7aaebd;" />
											</div>
										</td>
										<td width="22" class="STYLE22">
											<div align="center">
												页
											</div>
										</td>
										<td width="35">
											<a href="#" id="Start"><img src="<%=Admin%>/images/main_62.gif" width="26"
												height="15" /></a>
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
	</body>
</html>
